﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace AccessActiveDirectory
{
	class ConfiguredSettings
	{
		static public TimeSpan LdapClientTimeout { get { return new TimeSpan(0, 0, 1200); } }

		static public int TraceLevel { get { return 1; } }
	}

	class SharedLogic
	{
		static public void LogTraceInfo(TraceListener listenerToUse, Exception ex, TraceLevel messageLevel)
		{
			if (!Trace.Listeners.Contains(listenerToUse))
			{
				Trace.Listeners.Add(listenerToUse);
			}
			switch (messageLevel)
			{
				case TraceLevel.Error:
					Trace.TraceError("Exception Type:\t{0}\nError Message:\t{1}\nStack:\t{2}"
						, ex.GetType().ToString()
						, ex.Message
						, ex.StackTrace);
					break;
			}
			Trace.Listeners.Remove(listenerToUse);
		}
	}
}
